
#ifndef __TAL_MF_TEST_STORAGE_H__
#define __TAL_MF_TEST_STORAGE_H__

#include "tuya_cloud_types.h"


#ifdef __cplusplus
    extern "C" {
#endif


typedef enum {
    MF_UPDATE_DATA_PID = 0,
    MF_UPDATE_DATA_SINGED_CODE,
    MF_UPDATE_DATA_ZG_AUTH_KEY,
    MF_UPDATE_DATA_BLE_AUTH_KEY,    // not used(ble auth key same with zigbee auth key)
    MF_UPDATE_DATA_UUID,
    MF_UPDATE_DATA_COUNTRY_RF_INFO,
    MF_UPDATE_DATA_OEM_CFG,
    MF_UPDATE_DATA_LONG_PID,
    
    MF_UPDATE_DATA_ALL = 0xFE,
}MF_UPDATE_DATA_T;


#define AUTH_KEY_SIZE           32
#define COUNTRY_CODE_SIZE       (92+4)  // 4 bytes for alignment
#define ECC_SIGN_SIZE           40
#define MF_TEST_PID_SIZE        8
#define MF_TEST_EXT_PID_SIZE    16
#define MF_TEST_UUID_SIZE       16

// big oem cfg storage area size
#define OEM_BIG_CONFIG_MAX_DATA_LEN 2048

#pragma pack(push)
#pragma pack(1)
typedef struct {
    UINT_T valid;       // OEM config validation check
    UINT_T crc;         // Mf test crc32 check
    UINT16_T len;       // OEM config length
#ifdef MCU_CORE_8258
    UINT8_T data[];    // OEM Config data
#else
    UINT16_T reserve;   // Reserve
    UINT8_T data[0];    // OEM Config data
#endif
} oem_big_config_t;
#pragma pack(pop)



UINT_T tal_mf_test_big_oem_cfg_read(UINT8_T* buff, UINT_T size);
UINT_T tal_mf_test_big_oem_cfg_write(UINT8_T* buff, UINT_T size);
BOOL_T tal_mf_test_cfg_load(MF_UPDATE_DATA_T type, UINT8_T *data, UINT16_T len);
BOOL_T tal_mf_test_cfg_update(MF_UPDATE_DATA_T type, UINT8_T *data, UINT16_T len);



#ifdef __cplusplus
}
#endif

#endif

